<template>
  <div class="about">
    <p>a模块的数据：{{numA}}</p>
    <p>b模块的数据：{{numB}}</p>
    <p>a模块的钱：{{moneyA}}</p>
    <p>b模块的钱：{{moneyB}}</p>
    <!-- <button @click="add">A模块++</button> -->
    <button @click="addA">A模块++</button>
    <button @click="addB">B模块++</button>
  </div>
</template>
<script>
import { mapState,mapMutations,mapGetters } from 'vuex'
export default {
  created() {
    console.log(this.$store.state);
  },
  computed:{
    ...mapState({
      numA: state => state.a.numA,
      numB: state => state.b.numB,
    }),
    // ...mapGetters({
    //   moneyA: 'a/moneyA',
    //   moneyB: 'b/moneyB',
    // })
    ...mapGetters('a',['moneyA']),
    ...mapGetters('b',['moneyB'])
  },
  methods: {
    // ...mapMutations('a',['add']),
    ...mapMutations({
      addA: 'a/add',
      addB: 'b/add'
    })
  },
}
</script>
<style lang="" scoped>
  
</style>